package com.yunlan.materia.controller;

import com.yunlan.materia.entity.Result;
import com.yunlan.materia.request.DeletePatientInfoRequest;
import com.yunlan.materia.request.PatientInfoRequest;
import com.yunlan.materia.request.QueryPatientRequest;
import com.yunlan.materia.service.PatientInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 罗显
 * @date 2025/9/18
 * @ApiNote
 */
@Api(value = "病患模块")
@RestController("/api/materia/medica/patientInfo")
public class PatientInfoController {

    @Autowired
    PatientInfoService patientInfoService;

    @ApiOperation(value = "病患建档",notes = "病患建档",tags = {"病患模块"})
    @PostMapping("/add")
    public Result createPatientRecord(@RequestBody PatientInfoRequest request){
        return Result.success(patientInfoService.createPatientRecord(request));
    }

    @ApiOperation(value = "病患删档",notes = "病患删档",tags = {"病患模块"})
    @PostMapping("/delete")
    public Result deletePatientRecord(@RequestBody DeletePatientInfoRequest request){
        return Result.success(patientInfoService.deletePatientInfo(request));
    }

    @ApiOperation(value = "精确查询病患",notes = "精确查询病患",tags = {"病患模块"})
    @GetMapping("/queryPatientInfo")
    public Result queryPatientInfo(QueryPatientRequest request){
        return Result.success(patientInfoService.queryPatientInfo(request));
    }

    @ApiOperation(value = "模糊查询病患",notes = "模糊查询病患",tags = {"病患模块"})
    @GetMapping("/queryLikePatientInfo")
    public Result queryLikePatientInfo(QueryPatientRequest request){
        return Result.success(patientInfoService.queryPatientInfos(request));
    }

    @ApiOperation(value = "精确查询病患详情",notes = "精确查询病患详情",tags = {"病患模块"})
    @GetMapping("/queryPatientDetails")
    public Result queryPatientDetails(QueryPatientRequest request){
        return Result.success(patientInfoService.queryPatientDetails(request));
    }

}
